#include<stdio.h>
#include<netinet/in.h>
#include<sys/socket.h>
#include<sys/types.h>
#include<string.h>
#include<unistd.h>

int  main()
{
        int sd,portno,i;
        struct sockaddr_in cli;
        char msg[80],ip[80];
        sd=socket(AF_INET,SOCK_DGRAM,0);
        bzero(&cli,sizeof(cli));
        printf("enter the port no");
        scanf("%d",&portno);
        cli.sin_port=htons(portno);
        cli.sin_family=AF_INET;
        cli.sin_addr.s_addr=INADDR_ANY;
	 bind(sd,(struct sockaddr*)&cli,sizeof(cli));

	
        printf("\nreply from client\n");
        i=sizeof(cli);
        recvfrom(sd,msg,80,0,(struct sockaddr*)&cli,&i);
	printf("%s",msg);
	printf("\nenter the message to send\n");
	scanf("%s",msg);

        sendto(sd,msg,80,0,(struct sockaddr*)&cli,sizeof(cli));


	return 0;
}
